﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace WindowsFormsApplication1
{
    class xFiles
    {
        float N = 1; //Log File size in MB
FileInfo logFile = new FileInfo("c:\\myLogFile.txt");
if (logFile.Length > 1024 * N)
{
   logFile.Delete();
   logFile.Create();
}

using (StreamWriter logStream = logFile.AppendText())
   logStream.Write("String to write");
    }
}
